import com.itheima.dao.UserService;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TsetBeanLifecycle {
    public ClassPathXmlApplicationContext ctx;
    @Before
    public void init() {
        ctx = new ClassPathXmlApplicationContext("applicationContext.xml");

    }
    @Test
    public void tset01() {
        UserService userService4 = (UserService) ctx.getBean("userService4");
        userService4.add();
        ctx.close();
    }
    @Test
    public void tset02() {
        UserService userService6 = (UserService) ctx.getBean("userService5");
        UserService userService5 = (UserService) ctx.getBean("userService5");
        userService5.add();
        //ctx.close();
    }
}
